#!/bin/bash

cd lab2
CURRENT_URL=$(svn info | grep ^URL | cut -d" " -f2)
cd ..
ZIP=$(pwd)/zip

# R1
cd lab2
unzip -o ${ZIP}/commit1.zip -d .
svn resolve --accept working  *

svn add \*

svn commit -m "R1"
svn up
read -p "Press enter to continue"

# Creating new branch + R2
svn copy $CURRENT_URL $CURRENT_URL/blue -m "Creating blue branch"
svn switch $CURRENT_URL/blue .

unzip -o ${ZIP}/commit2.zip -d .
svn del \*

svn commit -m "R2"
svn up
read -p "Press enter to continue"

# Return to trunk
# R3
svn switch $CURRENT_URL .

unzip -o ${ZIP}/commit3.zip -d.

svn del \*
svn add bRtN7tD3SS.3Cx

svn commit -m "R3"
svn up
read -p "Press enter to continue"

# R4
unzip -o ${ZIP}/commit4.zip -d.
svn resolve --accept working  *

svn del bRtN7tD3SS.3Cx
svn add \*
svn add FKQZlRNSpA.uIw

svn commit -m "R4"
svn up
read -p "Press enter to continue"

# R5
unzip -o ${ZIP}/commit5.zip -d.
svn resolve --accept working  *

svn del FKQZlRNSpA.uIw
svn del \*
svn add 4HCmEf3Cxb.cIp

svn commit -m "R5"
svn up
read -p "Press enter to continue"

# Creating new branch + R6
svn copy $CURRENT_URL $CURRENT_URL/red -m "Creating red branch"
svn switch $CURRENT_URL/red .
unzip -o ${ZIP}/commit6.zip -d .
svn resolve --accept working  *
svn del 4HCmEf3Cxb.cIp
svn commit -m "R6"
svn up
read -p "Press enter to continue"

# R7
unzip -o ${ZIP}/commit7.zip -d .
svn resolve --accept working  *
svn add \*
svn commit -m "R7"
svn up
read -p "Press enter to continue"

# Go to blue
svn switch $CURRENT_URL/blue .
# R8
unzip -o ${ZIP}/commit8.zip -d .
svn resolve --accept working  *
svn add \*
svn commit -m "R8"
svn up
read -p "Press enter to continue"
# R9
unzip -o ${ZIP}/commit9.zip -d .
svn resolve --accept working  *
svn del \*
svn add bRtN7tD3SS.3Cx
svn commit -m "R9"
svn up
read -p "Press enter to continue 9"

#Go to trunk
svn switch $CURRENT_URL
# R10
unzip -o ${ZIP}/commit10.zip -d.
svn resolve --accept working  *
svn del bRtN7tD3SS.3Cx
svn del 4HCmEf3Cxb.cIp
svn commit -m "R10"
svn up
read -p "Press enter to continue 10"


#Go to red
svn switch $CURRENT_URL/red
# R11
unzip -o ${ZIP}/commit11.zip -d.
svn resolve --accept working  *
svn del \*
svn add bRtN7tD3SS.3Cx
svn commit -m "R11"
svn up
read -p "Press enter to continue 11"


# R12
unzip -o ${ZIP}/commit12.zip -d.
svn resolve --accept working  *
svn add \*
svn add FKQZlRNSpA.uIw
svn del bRtN7tD3SS.3Cx
svn commit -m "R12"
svn up
read -p "Press enter to continue 12"

# R13 + Merge red into blue
svn merge $CURRENT_URL/red $CURRENT_URL/blue
unzip -o ${ZIP}/commit13.zip -d.
svn del \*
svn del bRtN7tD3SS.3Cx
svn del FKQZlRNSpA.uIw
svn add ZlRNSpAcIp.FKQ
svn commit -m "R13"
read -p "Press enter to continue 12"


# R14 + Merge blue into trunk
svn merge $CURRENT_URL/blue $CURRENT_URL
unzip -o ${ZIP}/commit14.zip -d.
svn del ZlRNSpAcIp.FKQ
svn commit -m "R14"